package com.woniu.userservice.service.impl;

import com.woniu.userservice.entity.Auctions;
import com.woniu.userservice.dao.AuctionsDao;
import com.woniu.userservice.service.AuctionsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("auctionsService")
public class AuctionsServiceImpl implements AuctionsService {
    @Resource
    private AuctionsDao auctionsDao;

    @Override
    public Auctions queryById(Integer id) {
        return auctionsDao.queryById(id);
    }

    @Override
    public List<Auctions> queryAllByLimit(int offset, int limit) {
        return auctionsDao.queryAllByLimit(offset, limit);
    }
   
     @Override
    public List<Auctions> findAll() {
        return auctionsDao.findAll();
    }

    @Override
    public Auctions insert(Auctions auctions) {
        auctionsDao.insert(auctions);
        return auctions;
    }

    @Override
    public Auctions update(Auctions auctions) {
        auctionsDao.update(auctions);
        return queryById(auctions.getId());
    }

    @Override
    public boolean deleteById(Integer id) {
        return auctionsDao.deleteById(id) > 0;
    }

    @Override
    public Integer selectByGoodsid(Integer goodsid) {
        return auctionsDao.selectByGoodsid(goodsid);
    }
}